import React from 'react'
import ReactDOM from 'react-dom'

function formatName(user) {
  return user.firstName + ' ' + user.lastName
}

const user = {
  firstName: 'Harper',
  lastName: 'Peresz',
}

function getGreeting(user){
  if(user){
    return (<h1>Hello {formatName(user)}!</h1>)
  }else{
    return (<h1>Hello, Stranger</h1>)
  }
}
// const element = <h1>hello {formatName(user)}!</h1>

ReactDOM.render(getGreeting(user), document.getElementById('root'))
